package com.matt.domain.Notice;

import com.matt.foundation.DO.NoticeDO;
import com.matt.commons.model.Domain;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.List;


@Data
@Entity
@Table(name = "tb_notice")
@EqualsAndHashCode(callSuper = true)
public class Notice extends Domain {

    @Column(columnDefinition = " varchar(50) COMMENT '通知标题' ")
    private String title;

    @Column(columnDefinition = " varchar(1024) COMMENT '通知内容' ")
    private String content;

    @Column(columnDefinition = " varchar(32) COMMENT '上传人id' ")
    private String operatorId;

    @Column(columnDefinition = " varchar(50) COMMENT '上传人姓名' ")
    private String operatorName;

    @Column(columnDefinition = "varchar(100) COMMENT '头像'")
    private String headImgUrl = "";

    @Column(columnDefinition = " varchar(32) COMMENT '对应园区id' ")
    private String areaId;

    @Column(columnDefinition = " int default 1 COMMENT '类型 1：普通通知 2：活动通知 2：会议通知' ")
    private Integer noticeType=1;

    @Transient
    private List<NoticeDO> noticeClassList ;

    public static Notice of(String title, String content, String operatorId, String operatorName,String headImgUrl,String areaId,  Integer noticeType) {
        Notice notice = new Notice();
        notice.setTitle(title);
        notice.setContent(content);
        notice.setOperatorId(operatorId);
        notice.setOperatorName(operatorName);
        notice.setHeadImgUrl(headImgUrl);
        notice.setAreaId(areaId);
        notice.setNoticeType(noticeType);
        return notice;
    }
}
